home *** CD-ROM | disk | FTP | other *** search
/ Amiga News 95 / Amiga News 95.iso / dpat / dpat50 / cprg / compc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-21  |  4.3 KB  |  113 lines

  1. /*************************************************************************/
  2. /*                                                                       */
  3. /* COMPC.C et DECOMP.C Compression et décompression de fichiers source C */
  4. /*              V1.00 FREEWARE Christian BRUNON 20-08-1993               */
  5. /*                                                                       */
  6. /*             +-----------------------------------------+               */
  7. /*             | Logiciel placé dans le domaine FREEWARE |               */
  8. /*             +-----------------------------------------+               */
  9. /* L'utilisation et la diffusion de ce programme, des fichiers sources   */
  10. /* et de la documentation sont entièrement libres.                       */
  11. /*                                                                       */
  12. /*                           Christian BRUNON                            */
  13. /*                        30 Rue Georges Brassens                        */
  14. /*                      43140 LA SEAUVE SUR SEMENE                       */
  15. /*                                FRANCE                                 */
  16. /*                                                                       */
  17. /*            Fichier source Lattice C AmigaDOS Version 5.04             */
  18. /*                                                                       */
  19. /*************************************************************************/
  20.  
  21. /* Fichier Header contenant les constantes, macros, variables globales,  */
  22. /* structures et fonctions externes des fichiers sources Comp.C et DeCompC.C */
  23.  
  24. /* Fichiers INCLUDE */
  25. #define strlen __builtin_strlen
  26. #define strcpy __builtin_strcpy
  27. extern char *strcat(char *, char *);
  28. extern int strlen(char *);
  29. extern char *strcpy(char *, char *);
  30. #include <StdIO.H>
  31.  
  32. /* MACROS */
  33. #define UpChar(C) ((C) & (255-32))
  34.  
  35. /* Définitions de pseudo-types */
  36. #define BPTR  long
  37. #define UBYTE unsigned char
  38. #define LONG  long
  39. #define ULONG unsigned long
  40. #define UWORD unsigned short
  41.  
  42. /* CONSTANTES GLOBALES */
  43. /* Constantes d'erreur */
  44. #define FileOpenReadError 2
  45. #define CreateError       3
  46. #define WriteError        4
  47. #define ReadError         5
  48. #define MemoryError       6
  49. #define BreakError        7
  50.  
  51. #define MaxLongMot  30
  52. #define MaxMots    700
  53.  
  54. /* Codes de compression */
  55. #define NouveauMot '\0'
  56. #define MotExistant '\1'
  57. /* Début de commentaire /*  */
  58. #define Commentaire1On  2
  59. /* Fin de commentaire   étoile/  */
  60. #define Commentaire1Off 3
  61. /* Début de commentaire /* + espace */
  62. #define Commentaire2On  4
  63. /* Fin de commentaire   espace + étoile/ */
  64. #define Commentaire2Off 5
  65. #define LigneVide     255
  66.  
  67. /* VARIABLES GLOBALES */
  68. FILE *FIn,  /* Fichier lu    */
  69.      *FOut; /* Fichier écrit */
  70.  
  71. UBYTE NomFicIn[90],            /* Nom du fichier lu         */
  72.       NomFicOut[90],           /* Nom du fichier écrit      */
  73.       CodeErreur=0,            /* Code d'erreur             */
  74.       Mot[MaxLongMot],         /* Un mot lu                 */
  75.       LongMot,                 /* Longueur du mot lu        */
  76.       ComptLignes;             /* Compteur de lignes modulo */
  77.  
  78. static UWORD NbMots,  /* Nb de mots enregistrés */
  79.              CodeMot; /* Code du mot            */
  80.  
  81. static ULONG LongFicIn;
  82.  
  83. /* Structure utilisée par la structure FileInfoBlock */
  84. struct DateStamp
  85.   {
  86.    LONG ds_Days,
  87.         ds_Minute,
  88.         ds_Tick;
  89.   };
  90.  
  91. /* Structure utilisée pour Examine(), doit étre alignée sur une adresse divisible par 4 */
  92. struct FileInfoBlock
  93.   {
  94.    LONG   fib_DiskKey;
  95.    LONG   fib_DirEntryType;  /* Type of Directory. If < 0, then a plain file. If > 0 a directory */
  96.    char   fib_FileName[108]; /* Null terminated. Max 30 chars used for now */
  97.    LONG   fib_Protection;    /* bit mask of protection, rwed are 3-0.      */
  98.    LONG   fib_EntryType;
  99.    LONG   fib_Size;          /* Number of bytes in file */
  100.    LONG   fib_NumBlocks;     /* Number of blocks in file */
  101.    struct DateStamp fib_Date;/* Date file last changed */
  102.    char   fib_Comment[80];   /* Null terminated comment associated with file */
  103.    char   fib_Reserved[36];
  104.   };
  105.  
  106. /* Type à passer à la fonction Lock() */
  107. /* #define SHARED_LOCK    -2L  File is readable by others */
  108.    #define ACCESS_READ    -2L  /* Synonym                 */
  109. /* #define EXCLUSIVE_LOCK -1L  No other access allowed    */
  110. /* #define ACCESS_WRITE   -1L  Synonym                    */
  111.  
  112. #define LastChar(S) S[strlen(S)-1]
  113.